<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>注册</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.0/css/all.min.css">
    <link rel="stylesheet" href="/css/register.css?v=1.0">
</head>
<body>
<div class="container">
    <div class="row justify-content-center">
        <div class="col-lg-5">
            <div class="card">
                <div class="card-header">
                    <h2 class="mb-0">注册</h2>
                </div>
                <div class="card-body">
                    <!-- 显示注册失败信息 -->
                    <div th:if="${param.error}" class="alert alert-danger">
                        注册失败，请重试！
                    </div>
                    <form th:action="@{/register}" th:object="${root}" method="post">
                        <div class="mb-3">
                            <label for="username" class="form-label">用户名</label>
                            <input type="text" class="form-control" id="username" th:field="*{username}" required>
                        </div>
                        <div class="mb-3">
                            <label for="password" class="form-label">密码</label>
                            <input type="password" class="form-control" id="password" th:field="*{password}" required>
                        </div>
                        <button type="submit" class="btn btn-primary">注册</button>
                        <!-- 添加返回登录页的链接 -->
                        <a th:href="@{/login}" class="btn btn-secondary ms-2">返回登录页</a>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>